package factorytest.iflytek.com.einkiflytekfactorytest.engineer_test;

import android.os.Bundle;
import android.view.View;

import androidx.annotation.Nullable;

import factorytest.iflytek.com.einkiflytekfactorytest.FTFloatWindowService;
import factorytest.iflytek.com.einkiflytekfactorytest.R;
import factorytest.iflytek.com.einkiflytekfactorytest.common.FTUtils;
import factorytest.iflytek.com.einkiflytekfactorytest.config.EinkProperty;
import factorytest.iflytek.com.einkiflytekfactorytest.factorytestui.FactoryTestItemsEnum;

/**
 * Created by sst on 2018/7/11.
 */

public class FragmentAssistSettings extends BaseFragment {

    private final static String TAG = FragmentAssistSettings.class.getSimpleName();


    @Override
    protected int getLayoutRes() {
        return R.layout.fragment_engineer_assist_settings;
    }

    @Override
    protected void onInitView(@Nullable Bundle savedInstanceState) {

        View btnEnterBootLoader = findViewById(R.id.btnEnterBootLoader);
        if (btnEnterBootLoader != null) {
            btnEnterBootLoader.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    EinkProperty.enterBootloader();
                }
            });
        }

        View btnClearAgingResult = findViewById(R.id.btnClearAgingResult);
        if (btnClearAgingResult != null) {
            btnClearAgingResult.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {

                    FTUtils.clearAgingResult(mContext);
                }
            });
        }

        View btnClearPcbaResult = findViewById(R.id.btnClearPcbaResult);
        if (btnClearPcbaResult != null) {
            btnClearPcbaResult.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {

                    FactoryTestItemsEnum.pcba.setResult(mContext, mContext.getString(R.string.test_result_fail));
                    FTFloatWindowService.setPCBABtnShow(true);

                }
            });
        }
    }

}
